package come.example.pagetransformer.transform

import android.support.v4.view.ViewPager
import android.util.Log
import android.view.View

class AdTransformer : ViewPager.PageTransformer {

    override fun transformPage(view: View, position: Float) {
        var pos = position
        if (pos < -1) {
            pos = -1f
        } else if (pos > 1) {
            pos = 1f
        }
        val tempScale = if (pos < 0) 1 + pos else 1 - pos
        val scaleValue = 0.9f + tempScale * 0.1f

        Log.d(TAG, "<<<<<< position = $position, pos = $pos, tempScale $tempScale, scaleValue $scaleValue")
        view.scaleX = scaleValue
        view.scaleY = scaleValue
    }

    companion object {
        private val TAG = AdTransformer::class.java.simpleName
    }
}
